import moment from 'moment'

//获取行业字典数据
function getData1(request, response) {
    return response.$delay(1000, {
        list: Array.from({ length: 15 }).map((r, index) => ({
            label: "行业-" + index,
            value: "key-" + index,
        })),
    });
}

//获取行业景气指数
function getData2(request, response) {
    return response.$delay(1000, {
        list: Array.from({ length: 12 }).map((r, index) => ({
            label: "2020-" + (index + 1),
            value: ((Math.random() * 100) | 0),
        })),
    });
}

//监测100城新房销售面积于都额度走势
function getData3(request, response) {
    return response.$delay(1000, {
        list: Array.from({ length: 12 }).map((r, index) => {
            return {
                label: moment().add(index * 3, 'M').format('YYYY-MM'),
                //每个季度的销售面积
                value: ((Math.random() * 100) | 0) + 10,
                //每个季度的环比变化率
                value2: index > 1 ? (((Math.random() * 70) | 0) + 5) : -50,
            }
        }),
    });
}

//房地产企业销售业绩TOP5（截止2023年4月30日）
function getData4(request, response) {
    return response.$delay(1000, {
        list: Array.from({ length: 5 }).map((r, index) => {
            return {
                label: moment().add(index * 3, 'M').format('YYYY-MM'),
                //每个季度的销售面积
                value: ((Math.random() * 100) | 0) + 10,
                //每个季度的环比变化率
                value2: index > 1 ? (((Math.random() * 70) | 0) + 5) : -50,
            }
        }),
    });
}

//行业经营数据
function getData5(request, response) {

    //住宅
    const v1 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: `${index + 1}月`,
            //每个季度的销售面积
            value: ((Math.random() * 100) | 0) + 10,
            type: '住宅'
        }
    })
    //办公
    const v2 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: `${index + 1}月`,
            //每个季度的销售面积
            value: ((Math.random() * 100) | 0) + 10,
            type: '办公'
        }
    })

    //商业
    const v3 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: `${index + 1}月`,
            //每个季度的销售面积
            value: ((Math.random() * 100) | 0) + 10,
            type: '商业'
        }
    })

    return response.$delay(1000, {
        list: [...v1, ...v2, ...v3],
    });
}

//盈利能力
function getData6(request, response) {

    //销售毛利率
    const v1 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value2: ((Math.random() * 80) | 0) + 5,
            type: '销售毛利率'
        }
    })
    //销售净利润
    const v2 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value2: ((Math.random() * 80) | 0) + 5,
            type: '销售净利润'
        }
    })

    //ROE(摊薄)
    const v3 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value2: ((Math.random() * 80) | 0) + 5,
            type: 'ROE(摊薄)'
        }
    })

    // 营业收入
    const v4 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value: ((Math.random() * 80) | 0) + 5,
            type: '营业收入'
        }
    })

    const lineData = [...v1, ...v2, ...v3]
    const barData = v4

    return response.$delay(1000, {
        list: [barData, lineData]
    });
}

// 盈利能力- 字典数据
function getData7(request, response) {
    return response.$delay(1000, {
        list: [{
            value: '1',
            label: '一季报'
        }, {
            value: '2',
            label: '半年报'
        }, {
            value: '3',
            label: '三季报'
        }, {
            value: '4',
            label: '年报'
        }]
    });
}

function getData8(request, response) {
    return response.$delay(1000, {
        list: [{
            value: '1',
            label: '固定资产周转率'
        }, {
            value: '2',
            label: '存货周转率'
        }, {
            value: '3',
            label: '应收账款周转率'
        }, {
            value: '4',
            label: '应付账款周转率'
        }, {
            value: '5',
            label: '存货周转天数'
        }, {
            value: '6',
            label: '应收账款周转天数'
        }, {
            value: '7',
            label: '应付账款周转天数'
        }]
    });
}

function getData9(request, response) {
    return response.$delay(1000, {
        list: [{
            value: '1',
            label: '营业收入'
        }]
    });
}

//营运能力
function getData10(request, response) {

    //固定资产周转率
    const v1 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value2: ((Math.random() * 80) | 0) + 5,
            type: '固定资产周转率'
        }
    })
    //存货周转率
    const v2 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value2: ((Math.random() * 80) | 0) + 5,
            type: '存货周转率'
        }
    })

    //应收账款周转率
    const v3 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value2: ((Math.random() * 80) | 0) + 5,
            type: '应收账款周转率'
        }
    })

    // 营业收入
    const v4 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value: ((Math.random() * 80) | 0) + 5,
            type: '营业收入'
        }
    })

    const lineData = [...v1, ...v2, ...v3]
    const barData = v4

    return response.$delay(1000, {
        list: [barData, lineData]
    });
}



//偿债能力
function getData11(request, response) {

    //流动比率
    const v1 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value2: ((Math.random() * 80) | 0) + 5,
            type: '流动比率'
        }
    })
    //速动比率
    const v2 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value2: ((Math.random() * 80) | 0) + 5,
            type: '速动比率'
        }
    })

    //保守速动比率
    const v3 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value2: ((Math.random() * 80) | 0) + 5,
            type: '保守速动比率'
        }
    })

    // 营业收入
    const v4 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value: ((Math.random() * 80) | 0) + 5,
            type: '营业收入'
        }
    })

    const lineData = [...v1, ...v2, ...v3]
    const barData = v4

    return response.$delay(1000, {
        list: [barData, lineData]
    });
}


//成长能力
function getData12(request, response) {

    //同比
    const v1 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value2: ((Math.random() * 80) | 0) + 5,
            type: '同比'
        }
    })

    // 归母净利润
    const v4 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            //每个季度的销售面积
            value: ((Math.random() * 80) | 0) + 5,
            type: '归母净利润'
        }
    })

    const lineData = v1
    const barData = v4

    return response.$delay(1000, {
        list: [barData, lineData]
    });
}

// 龙头企业分析--盈利能力
function getData13(request, response) {

    //企业一
    const v1 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value: ((Math.random() * 80) | 0) + 5,
            type: '企业一'
        }
    })
    //企业二
    const v2 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value: ((Math.random() * 80) | 0) + 5,
            type: '企业二'
        }
    })

    //企业三
    const v3 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value: ((Math.random() * 80) | 0) + 5,
            type: '企业三'
        }
    })
    //企业四
    const v4 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value: ((Math.random() * 80) | 0) + 5,
            type: '企业四'
        }
    })
    //企业五
    const v5 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value: ((Math.random() * 80) | 0) + 5,
            type: '企业五'
        }
    })


    const lineData = [...v1, ...v2, ...v3, ...v4, ...v5]

    return response.$delay(1000, {
        list: lineData
    });
}

function getData14(request, response) {
    return response.$delay(1000, {
        list: [{
            value: '1',
            label: '近三年'
        }, {
            value: '2',
            label: '近五年'
        }, {
            value: '3',
            label: '近十年'
        }]
    });
}

// 资产负债表
function getData15(request, response) {
    let uid = 1
    function createData(createChl, count) {
        return Array.from({ length: (count || 40) }).map((r, index) => {
            return {
                id: ('key' + (uid++)),
                type: '分类',
                [moment().add(0, 'Y').format('YYYY')]: ((Math.random() * 80) | 0) + 5,
                [moment().add(1, 'Y').format('YYYY')]: ((Math.random() * 80) | 0) + 5,
                [moment().add(2, 'Y').format('YYYY')]: ((Math.random() * 80) | 0) + 5,
                [moment().add(3, 'Y').format('YYYY')]: ((Math.random() * 80) | 0) + 5,
                [moment().add(4, 'Y').format('YYYY')]: ((Math.random() * 80) | 0) + 5,
                [moment().add(5, 'Y').format('YYYY')]: ((Math.random() * 80) | 0) + 5,
                [moment().add(6, 'Y').format('YYYY')]: ((Math.random() * 80) | 0) + 5,
                [moment().add(7, 'Y').format('YYYY')]: ((Math.random() * 80) | 0) + 5,
                ...(typeof createChl === 'function' ? { children: createChl(null, 20) } : {})
            }
        })
    }
    const topL = createData(createData, 4)

    return response.$delay(1000, {
        list: topL
    });
}

//负债表详情
function getData16(request, response) {
    const d = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value: ((Math.random() * 80) | 0) + 5
        }
    })
    response.$delay(1000, {
        list: d
    });
}


//房地产行业 -近五年房地产行业投资趋势
function getData17(request, response) {
    //金额（￥百万）
    const v1 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value2: ((Math.random() * 80) | 0) + 5,
            type: '金额（￥百万）'
        }
    })

    // 案例数(个)
    const v = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value: ((Math.random() * 80) | 0) + 5,
            type: '案例数(个)'
        }
    })

    const lineData = v1
    const barData = v

    return response.$delay(1000, {
        list: [barData, lineData]
    });
}


//房地产行业 -近五年房地产行业投资趋势
function getData18(request, response) {

    //单笔最高金额
    const v1 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value: ((Math.random() * 80) | 0) + 5,
            type: '单笔最高金额'
        }
    })
    //本轮金额
    const v2 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value: ((Math.random() * 80) | 0) + 5,
            type: '本轮金额'
        }
    })

    //平均金额
    const v3 = Array.from({ length: 12 }).map((r, index) => {
        return {
            label: moment().add(index, 'Y').format('YYYY'),
            value: ((Math.random() * 80) | 0) + 5,
            type: '平均金额'
        }
    })

    const lineData = [...v1, ...v2, ...v3]

    return response.$delay(1000, {
        list: lineData
    });
}

//房地产行业 -融资阶段统计
function getData19(request, response) {

    const v1 = Array.from({ length: 10 }).map((r, index) => {
        return {
            label: (1 + index) + '论融资',
            value: ((Math.random() * 30) | 0) + 5
        }
    })

    return response.$delay(1000, {
        list: v1
    });
}

// 投融资区域分布
function getData20(request, response) {
    const data = [
        { name: "北京", value: 0, add: 10 },
        { name: "天津", value: 0, add: 11 },
        { name: "河北", value: 0, add: 12 },
        { name: "山西", value: 0, add: 13 },
        { name: "内蒙古", value: 0, add: 14 },
        { name: "辽宁", value: 0, add: 15 },
        { name: "吉林", value: 0, add: 16 },
        { name: "黑龙江", value: 0, add: 17 },
        { name: "上海", value: 0, add: 18 },
        { name: "江苏", value: 0, add: 19 },
        { name: "浙江", value: 0, add: 20 },
        { name: "安徽", value: 0, add: 21 },
        { name: "福建", value: 0, add: 22 },
        { name: "江西", value: 0, add: 23 },
        { name: "山东", value: 0, add: 24 },
        { name: "河南", value: 0, add: 25 },
        { name: "湖北", value: 0, add: 26 },
        { name: "湖南", value: 0, add: 27 },
        { name: "广东", value: 0, add: 28 },
        { name: "广西", value: 0, add: 29 },
        { name: "海南", value: 0, add: 30 },
        { name: "重庆", value: 0, add: 31 },
        { name: "四川", value: 0, add: 32 },
        { name: "贵州", value: 0, add: 33 },
        { name: "云南", value: 0, add: 34 },
        { name: "西藏", value: 0, add: 35 },
        { name: "陕西", value: 0, add: 36 },
        { name: "甘肃", value: 0, add: 37 },
        { name: "青海", value: 0, add: 38 },
        { name: "宁夏", value: 0, add: 39 },
        { name: "新疆", value: 0, add: 40 },
        { name: "台湾", value: 0, add: 41 },
        { name: "香港", value: 0, add: 42 },
        { name: "澳门", value: 0, add: 43 },
        { name: "十段线", value: 0, add: 44 },
        { name: "南海诸岛", value: 0, add: 45 }
    ]
    const v1 = data.map((r, index) => {
        return {
            ...r,
            value: index > 10 ? 0 : ((Math.random() * 30) | 0) + 5
        }
    })

    return response.$delay(1000, {
        list: v1
    });
}

function getData21(request, response) {
    const data = [
        { name: "北京", value: 0, add: 10 },
        { name: "天津", value: 0, add: 11 },
        { name: "河北", value: 0, add: 12 },
        { name: "山西", value: 0, add: 13 },
        { name: "内蒙古", value: 0, add: 14 },
        { name: "辽宁", value: 0, add: 15 },
        { name: "吉林", value: 0, add: 16 },
        { name: "黑龙江", value: 0, add: 17 },
        { name: "上海", value: 0, add: 18 },
        { name: "江苏", value: 0, add: 19 },
        { name: "浙江", value: 0, add: 20 },
        { name: "安徽", value: 0, add: 21 },
        { name: "福建", value: 0, add: 22 },
        { name: "江西", value: 0, add: 23 },
        { name: "山东", value: 0, add: 24 },
        { name: "河南", value: 0, add: 25 },
        { name: "湖北", value: 0, add: 26 },
        { name: "湖南", value: 0, add: 27 },
        { name: "广东", value: 0, add: 28 },
        { name: "广西", value: 0, add: 29 },
        { name: "海南", value: 0, add: 30 },
        { name: "重庆", value: 0, add: 31 },
        { name: "四川", value: 0, add: 32 },
        { name: "贵州", value: 0, add: 33 },
        { name: "云南", value: 0, add: 34 },
        { name: "西藏", value: 0, add: 35 },
        { name: "陕西", value: 0, add: 36 },
        { name: "甘肃", value: 0, add: 37 },
        { name: "青海", value: 0, add: 38 },
        { name: "宁夏", value: 0, add: 39 },
        { name: "新疆", value: 0, add: 40 },
        { name: "台湾", value: 0, add: 41 },
        { name: "香港", value: 0, add: 42 },
        { name: "澳门", value: 0, add: 43 },
        { name: "十段线", value: 0, add: 44 },
        { name: "南海诸岛", value: 0, add: 45 }
    ]
    const v1 = data.map((r, index) => {
        return {
            ...r,
            value: index > 10 ? 0 : ((Math.random() * 30) | 0) + 5
        }
    })

    return response.$delay(1000, {
        list: v1
    });
}
export {
    getData1, getData2, getData3, getData4, getData5, getData6, getData7, getData8, getData9, getData10, getData11, getData12
,getData13,getData14,getData15,getData16,getData17, getData18, getData19,getData20,getData21
}